import url from "@/url.config";
import {method} from "lodash";

export default ({service, request, tools}) => ({
    //保存采购申请草稿
    saveDraft(data) {
        return request({
            url: url.ip3 + "/procurement/save",
            method: "post",
            data: data,
        });
    },
    //采购类型查询
    lookLeixing() {
        return request({
            url: url.ip3 + "/procurement/find/type",
            method: "get",
        });
    },
    //存为草稿
    saveProcurement(data) {
        return request({
            url: url.ip3 + "/procurement/save",
            method: "post",
            data: data,
        });
    },
    //查找采购清单
    findProcurement(value) {
        return request({
            url: url.ip3 + `/spare/parts/getEnum?name=${value}`,
            method: "get"
        })
        // return request({
        //   url: url.ip3 + "/procurement/find/dictionary",
        //   method: "post",
        //   data: data,
        // });
    },
    //查看清单详情
    lookListDetail(id) {
        return request({
            url: url.ip3 + "/procurement/find/detail/" + id,
            method: "get",
        });
    },
    //修改清单
    modifyList(data) {
        return request({
            url: url.ip3 + "/procurement/edit",
            method: "put",
            data: data,
        });
    },
    //上报申请
    onReport(id, userid) {
        return request({
            url: url.ip3 + "/procurement/submit/" + id + "/" + userid,
            method: "put",
        });
    },
    //获取权限人员
    getjurisdiction() {
        return request({
            url: url.ip3 + "/procurement/find/userId",
            method: "get",
        });
    },
    //查找审核进度列表
    findAudit(data) {
        return request({
            url: url.ip3 + "/procurement/find/audit/plan",
            method: "post",
            data: data
        });
    },
    //查找采购审核详情信息，进行审核
    fingDetail(data) {
        return request({
            url: url.ip3 + "/procurement/find/audit/detail",
            method: "post",
            data: data
        })
    },
    //清单意见审批
    checkList(data) {
        return request({
            url: url.ip3 + "/procurement/audit",
            method: "post",
            data: data
        })
    },
    //采购完成接口
    purchaseCompleted(data) {
        return request({
            url: url.ip3 + "/procurement/procurement/success",
            method: "post",
            data: data
        })
    },
    procurementSaveGoods(data) {
        return request({
            url: url.ip3 + "/procurement/save/to/goods",
            method: "post",
            data: data
        })
    },
    //删除审核数据
    deleteList(id) {
        return request({
            url: url.ip3 + "/procurement/delete/" + id,
            method: "delete",
        })
    },
    // 删除单条记录里单个备件数据
    deleteListItem(id){
      return request({
          url:url.ip3+ `/procurement/remove/list/${id}`,
          method:"delete"
      })
    },
    //根据级别查询组织架构信息
    findAreaInfoByLevel(id, key) {
        return request({
            url: url.ip2 + "/area/findAreaInfoByLevel" + "?level=" + id + "&searchKey=" + key,
            method: "get",
        })
    },
    //获取申请中心数据
    getApplyCenterData(data) {
        return request({
            url: url.ip3 + "/procurement/find/page",
            method: "post",
            data: data
        })
    },
    //上报申请
    onReport_z(data) {
        return request({
            url: url.ip3 + "/procurement/submit",
            method: "put",
            data: data
        });
    },
    procurementPurchaseStatusId(id) {
        return request({
            url: url.ip3 + `/procurement/purchase/8/${id}`,
            method: 'put'
        })
    },
    //  判断用户是否可以新建申领
    procurementIsSave() {
        return request({
            url: url.ip3 + "/procurement/is/save",
            method: "get"
        })
    }
});
